#!/usr/bin/make -f

%:
	dh ${@}


override_dh_auto_build:
	# Remove Electron bundle
	sed -i '/"electron":/d' package.json
	sed -i '/"electron-builder":/d' package.json
	sed -i '/"electron-builder-notarize":/d' package.json
	sed -i '/"electron-devtools-installer":/d' package.json
	sed -i '/"electron-notarize":/d' package.json
	sed -i '/"electron-osx-sign":/d' package.json
	
	# skip postinstall
	sed -i 's/"postinstall": ".*"/"abcd": "efgh"/g' package.json
	
	# Reduce output of webpack
	sed -i 's| --progress --colors||g' package.json
	
	# Build
	yarn install
	yarn run pack
	yarn install --production --ignore-scripts --prefer-offline
	cp static/512x512.png motrix.png
	
	# Delete unused files
	rm -f node_modules/*/{CHANGELOG.md,README.md,README,readme.md,readme}
	rm -rf node_modules/.cache

